cmake_minimum_required(VERSION 3.16)
project(irbuilder_demo LANGUAGES CXX)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

find_package(LLVM REQUIRED CONFIG)

message(STATUS "Found LLVM ${LLVM_PACKAGE_VERSION}")
message(STATUS "Using LLVMConfig.cmake in ${LLVM_DIR}")

list(APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_DIR}")
include(AddLLVM)

add_executable(irbuilder-demo src/main.cpp)
target_include_directories(irbuilder-demo PRIVATE ${LLVM_INCLUDE_DIRS})
target_compile_definitions(irbuilder-demo PRIVATE ${LLVM_DEFINITIONS})
llvm_map_components_to_libnames(LLVM_LIBS core)
target_link_libraries(irbuilder-demo PRIVATE ${LLVM_LIBS})
